//
//  MBLoginFooterView.m
//  MobellCloud_ios
//
//  Created by cherry pu on 2017/12/27.
//  Copyright © 2017年 zhangXin. All rights reserved.
//

#import "MBLoginFooterView.h"

@interface MBLoginFooterView ()

@end

@implementation MBLoginFooterView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        UIButton* loginButton = [[UIButton alloc]init];
        self.loginButton = loginButton;
        loginButton.userInteractionEnabled = NO;
        [loginButton setBackgroundImage:[UIImage imageFromColor:[UIColor colorWithR:255 G:99 B:0 A:0.6] forSize:CGSizeMake(SCREEN_WIDTH-[UIView lf_sizeFromIphone6:48], [UIView lf_sizeFromIphone6:49]) withCornerRadius:[UIView lf_sizeFromIphone6:4]] forState:UIControlStateNormal];
        [loginButton setBackgroundImage:[UIImage imageFromColor:[UIColor colorWithR:255 G:99 B:0 A:1] forSize:CGSizeMake(SCREEN_WIDTH-[UIView lf_sizeFromIphone6:48], [UIView lf_sizeFromIphone6:49]) withCornerRadius:[UIView lf_sizeFromIphone6:4]] forState:UIControlStateSelected];
        [loginButton setTitle:@"登录" forState:UIControlStateNormal];
        loginButton.titleLabel.font = [UIFont lf_systemFontOfSize:16];
        [self addSubview:loginButton];
        
        [loginButton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self).with.offset([UIView lf_sizeFromIphone6:80]);
            make.centerX.equalTo(self);
            make.size.mas_equalTo(CGSizeMake(SCREEN_WIDTH-[UIView lf_sizeFromIphone6:48], [UIView lf_sizeFromIphone6:49]));
        }];
        
    }
    return self;
}

-(void)setIsEnable:(BOOL)isEnable
{
    _isEnable = isEnable;
    
    self.loginButton.userInteractionEnabled = isEnable;
    self.loginButton.selected = isEnable;
}

@end
